import {get, post} from '@/utils/request';

export default class CommonAPI {

  url;

  static create(url){
    return new CommonAPI(url);
  }

  constructor(url) {
    this.url = url;
  }

  list(currentPage, conditions = null, orders = null) {
    return post(`${this.url}/list`, {currentPage, conditions, orders});
  }

  listAll(conditions = null, orders = null) {
    return post(`${this.url}/listAll`, {conditions, orders});
  }

  insertOrUpdate(data) {
    return post(`${this.url}/insertOrUpdate`, data);
  }

  del(id) {
    return get(`${this.url}/delete`, {id});
  }

}
